package com.atguigu.spzx.model.vo.common;

import com.atguigu.spzx.model.myemun.ResultCodeEnum;
import lombok.Data;

@Data

public class Result<T> {
    private Integer code;
    private String message;
    private T data;
private Result() {
}
public static<T> Result<T> build(Integer code, String message, T data) {
    Result<T> result = new Result<>();
    result.setCode(code);
    result.setMessage(message);
    result.setData(data);
    return result;
}

    public static <T> Result<T> build(T data, ResultCodeEnum resultCodeEnum) {
        return build(resultCodeEnum.getCode(), resultCodeEnum.getMessage(), data);

    }

    public static Result build(ResultCodeEnum resultCodeEnum) {
    return build(resultCodeEnum.getCode(), resultCodeEnum.getMessage(), null);
    }
}
